<?php 
	$pPageIsPublic = false;
	include '../_common.php';
	$_SESSION["m1"]="destination";
	$_SESSION["m2"]="continent-list";
	
	
	$pTitle  = 'New Continent Style';
	$pButton = 'Save';
	$action  = 'add';
	$id 	 = intval($_REQUEST['id']);
	$seo	 = NULL;
	
	
	$objCont = new Continent();
	$objCont ->setUid($id);
	if ($objCont ->load()) {
		$pTitle  = 'Edit Continent';
		$pButton = 'Update';
		$action  = 'edit';
		//$locationMap = json_decode($objCont ->locationMap);
	}
	
	if (isset($_POST['submit'])) {
		$objCont ->setAuto($_POST);
		//$objCont ->locationMap = arr2json($_POST, array('metaTitle', 'metaDescription', 'metaKeyword', 'friendlyUrl'));
		
		if ($_POST['action'] == 'edit') {
			$objCont ->getConnection();
			$objCont ->setUid($id);
			$objCont ->update();
			Tzn::redirect("continent-list.php?id=". $objCont ->id, 'Continent has been updated.');
		} elseif ($_POST['action'] == 'add') {
			$objCont ->add();
			Tzn::redirect("continent-list.php?id=". $objCont ->id, 'Continent has been added.');
		}
	}

?>
<?php include("header.php"); ?>
<script type="text/javascript">
$(document).ready(function(){
	$('#frmMain').validate();	
});
</script>
<?php include("sidebar.php"); ?>
		<ul id="subnav" class="bar" >
			<li ><a href="continent-list.php" > Continent List </a></li>
			<li><font>&raquo;</font></li>
			<li class="noborder" ><span><?php echo $pTitle;?> </span></li>
		</ul>
<div id="list">
	<h2> <?php echo $pTitle;?> </h2>
			<form action="" method="post" name = "frmMain" id = "frmMain"  >
			<fieldset><legend> General Info </legend>
					<table cellpadding="0" cellspacing="0" class="table-form"  >
						<tr>
							<th>Title: </th>
							<td><?php $objCont ->qText('title', '', 'width:548px', 'class="required"');?></td>
						</tr>
						<tr>
							<th>Status: </th>
							<td><?php $objCont ->arrayToSelect($objCont ->_arrStatus, 'status', $objCont ->status, false, 'width:100px', '');?></td>
						</tr>
					</table>
			</fieldset>
			<div style="margin-top:10px">
				<input type="hidden" name="id" value="<?php echo $id; ?>" />
				<input type="hidden" name="action" value="<?php echo $action; ?>" />
                <input type="submit" name="submit"  value="<?php echo $pButton; ?>" /> &nbsp; <input type="reset" value="Cancel" onClick="window.location.href='continent-list.php'" />
            </div>
            </form>
</div>
<?php include("footer.php"); ?>